#include <iostream>
#include <algorithm>
using namespace std;
const int N=1e5+10;
double a[N];
double b[N];
double dp[N];
void solve()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        cin>>b[i];
    }
    dp[n]=a[n]/2+b[n]/2;
    for(int i=n-1;i>=1;i--)
    {
        dp[i]=min(dp[i+1],a[i])/2+min(dp[i+1],b[i])/2;
    }
    printf("%.6lf\n",dp[1]);
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
